var actionName;
var dictionaryName;
var confirmStr;
var chiocenothing;
var dicTypeId;

//新建
function goNew(){
	document.location.href=actionName+"-input.action?orig=input";
}
//删除
function goDel(id){
	if(confirm(confirmStr))
		document.location.href=actionName+"-delete.action?key="+id;
}
//编辑
function goEdit(param,id){
	document.location.href=actionName+"-input.action?"+param+"="+id+"&orig=edit";
}
//批量删除
function goBatchDel(){
	if($("input[name='key']:checked").size()==0){
		alert(chiocenothing);
		return;
	}
	if(confirm(confirmStr)){
		$("#action_form").submit();
	}
}
//全选按钮
function selAll(){
	if($("input[name=all]")[0].checked==true)
	{
		for(var i=0;i<$("input[name=key]").length;i++)
		{
			$("input[name=key]")[i].checked=true;
		}	
	}
	else
	{
		for(var i=0;i<$("input[name=key]").length;i++)
		{
			$("input[name=key]")[i].checked=false;
		}
	}
}
//反选按钮
function antiSelect(){
	flag=1;
	for(var i=0;i<$("input[name=key]").length;i++)
	{
		if($("input[name=key]")[i].checked==true)
		{
			$("input[name=key]")[i].checked=false;
			flag=0;
		}
		else
		{
			$("input[name=key]")[i].checked=true;
		}
	}
	if(flag==1) 
	{
		$("input[name=all]")[0].checked=true;
	}
	else
	{
		$("input[name=all]")[0].checked=false;
	}
}
/**
 * 获取当前URL地址的
 */
function GetQueryObject(){
	var url = location.href;
	var paraString = url.substring(url.indexOf("?")+1,url.length).split("&"); 
	var paraObj = {};
	for (i=0; j=paraString[i]; i++){
		paraObj[j.substring(0,j.indexOf("="))] = j.substring(j.indexOf("=")+1,j.length);
	}
	if(typeof(paraObj)=="undefined"){
		return "";
	}else{
		return paraObj; 
	}
}
/**
 * 获取没有分页信息的URL地址
 * @returns
 */
function GetNoPageUrl(){
	var url = location.href;
	if(url.indexOf("?")>0)
		url = url.substring(0, url.indexOf("?"));
	var queryObject = GetQueryObject();
	if(queryObject=="")
		return url;
	
	for(var item in queryObject){
		if(item=="" || ignore(item))
			continue;
		if(url.indexOf("?")>0)
			url += "&";
		else
			url += "?";
		url += item+"="+queryObject[item];
	}
	return url;
}
/**
 * 忽略分页特有参数
 * @param key
 * @returns {Boolean}
 */
function ignore(key){
	if(key=="page.pageNo")
		return true;
	if("page.pageSize"==key){
		return true;
	}
	if("page.orderBy"==key){
		return true;
	}
	if("page.order"==key){
		return true;
	}
	return false;
}
/**
 * 过滤url地址以?,&结束的字符
 * @param url
 */
function filterUrl(url){
	if(url.indexOf("?")==url.length-1 || url.indexOf("&")==url.length-1)
		return url.substring(0,url.length-1);
	return url;
}
//判断是否是整数
function IsInt(str){
	if (str==""){
	return false;
	}
	if (parseInt(str)==NaN || isNaN(str)){
		return false;
	}
	return true;
}

//查询展开及收拢菜单
function extend(){
	if($('#extend').html()=="高级查询")
	{
		for(var i=0;i<$('.extend').length;i++)
		{
			$('.extend')[i].style.display="";
		}
		$('#extend').html("简单查询");
	}
	else
	{
		for(var i=0;i<$('.extend').length;i++)
		{
			$('.extend')[i].style.display=$('.extend')[i].className=="extend"?"none":"";
		}
		$('#extend').html("高级查询");
	}
}
window.onload = function(){
	var btnmove=document.getElementsByTagName("input");
	var i = 0,j = btnmove.length;
	for (; i < j; i = i + 1){
		if (btnmove[i].type == "button" || btnmove[i].type == "reset" || btnmove[i].type == "submit"){
			btnmove[i].onmouseover = function(){
				if (this.className == "btnlist2"){
					this.className ="btnlist2move"
					
				}
				if (this.className == "btnlist4"){
					this.className ="btnlist4move"
					
				}
			}
			btnmove[i].onmouseout = function(){
				if (this.className == "btnlist2move"){
					this.className ="btnlist2"
					
				}
				if (this.className == "btnlist4move"){
					this.className ="btnlist4"
					
				}
			}
			
		}
		
	}
}
/*
**  cms.js 1.0 is edited by jianggc 
**  this is testing, so there may be some problems.
**	please don't modify anything except Jiang
*/
if (typeof AR == "undefined" || !AR) {
	var AR = AR || {}
}
AR = function() {
	this.g = function(D) {
		if ( D.indexOf(" ") == -1){
			return ( D.substring(0,1) === "#") ? document.getElementById(D.substring(1,D.length)) : document.getElementsByTagName(D);
		}
		else {
			var ary = D.split(" ");
			return this.g(ary[0]).getElementsByTagName(ary[1])
		}
	}
}
AR.prototype = {

	trim: function(R) {
		return R.replace(/^\s+|\s+$/g,"")
	},
	cut: function(R,M,N){
		return R = (R.length < N) ? R : R.slice(M,N);
	},
	numAll: function(R,M,N) {
		var rx=eval("(" +"/^\d{"+M+","+N+"}$/" +")");
		return (!R || !rx.exec(R)) ? true : false;
	},
/*
**  正则验证 
**  strall:全部是字母;chinese:全部是汉字;username:用户名【以字母开头，字母、数字、下划线】;mobile:手机【以1开头的11位数字】;email:邮箱【字母、数字、下划线+@+字母、数字、下划线+.+2-7个字母】
**	R:验证的字符; M:数字量始; N:数字量终;
**  return true[对] or false[错]
**	eg: username("jxiao",5,18) //return true
*/
	strall: function(R,M,N) {
		var rx = eval("(" +"/^[a-zA-Z]{"+M+","+N+"}$/"+")");
		return (!R || !rx.exec(R)) ? false : true;
		
	},
	chinese: function(R,M,N) {
		var rx = eval("(" +"/^[\u4E00-\u9FA5]{"+M+","+N+"}$/"+")");
		return (!R || !rx.exec(R)) ? false : true;
	},
	username: function(R,M,N) {
		var rx = eval("(" +"/^[a-zA-Z][a-zA-z0-9\_]{"+(M-1)+","+(N-1)+"}$/"+")");
		return (!R || !rx.exec(R)) ? false : true;
		
	},
	mobile: function(R) {
		var rx = /^[1]{1}(\d){10}$/;  
		return (!rx.exec(R)) ?  false : true;
	},
	email: function(R) {
		var rx = /^\w+@\w+\.[a-zA-Z]{2,7}$/;
		return (!rx.exec(R)) ? false : true;
	},
	
/*
**  hasClass: 判断某元素下是否有某样式 
**  D:查检元素ID; S:样式名
**  return true[有] or false[无]
**	eg: hasClass("#nodeid","classname")
*/
	hasClass: function(D, S) { 
		var t = this;
		var d = t.g(D), s = t.trim(S), dc = t.trim(d.className);
		if ( !d || !S || !dc) {
			return false;
		}
		if (dc.indexOf(" ") == -1) {
			return (eval("("+"/^"+s+"$/"+")").exec(dc)) ? true : false;
		} else if (dc.indexOf(" ") != -1) {
			var ar = dc.split(" "), i = 0, j = ar.length;
			for (; i < j ; i ++ ) {
				if (eval("("+"/^"+s+"$/"+")").exec(ar[i])) {
					return true;
				}
			}
			return false;
		}
	},
/*
**  addClass: 为某元素附加样式 
**  D:查检元素ID; S:样式名
**	eg: addClass("#nodeid","classname")
*/
	addClass: function(D, S) { 
		var t = this;
		var d = t.g(D);
		if ( !d || !S) {
			return false;
		}
		d.className += " " + S;
	},
	removeClass: function(D, S) { 
		var t = this;
		var d = t.g(D);
		if ( !t.hasClass(D, S)) {
			return;
		}
		d.className = d.className.replace(new RegExp(S,"g"),"");
		
	},
	bodysize: function() {
		var _h = parent.document.documentElement.clientHeight, _h2 = parent.document.body.clientHeight;
		_h = ( _h > _h2 ) ? _h : _h2;
		var ar = [document.body.clientWidth,_h];
		return ar;
	},
	arrdel: function(D,N) {
		if ( !D || N < 0 || isNaN(N)) {
			return;
		}
		else {
			return D.slice(0,N).concat(D.slice(N+1,D.legnth));
		}
	},
	addEvent: function(D, O, U) { 
		var t = this;
		d = t.g(D);
		if ( !d || !O || typeof(U) != "function") {
			return false;
		}
		if ( d.addEventListener) {
			d.addEventListener(O,U,false);
		}
		else if ( d.attachEvent) {
			d.attachEvent("on"+O,U)
		} else {
			d["on" + O] = U;
		}
	},
	removeEvent: function(D,O,U) {
		if ( D.removeEventListener ) {
			D.removeEventListener (D,O,false);
		} else if ( D.attachEvent) {
			D.detachEvent("on"+O,U);
		} else {
			D["on"+O] = U;
		}
	},
	stopEvent: function(v){ 
		if (v.stopPropagation)
		{
			v.stopPropagation();
		}
		else{
			v.cancelBubble = true;
		}
		if (v.preventDefault)
		{
			v.preventDefault();
		} else {
			e.returnValue = false;
		}
	},
	discolor: function(D, S) {
		var t = this;
		if ( !t.g(D) ) {
			return;
		}	
		var d = t.g(D), i = 0, j = d.length;
		for ( ; i < j ; i ++ ) {
			d[i].className = i%2 ? S : "";
		}
	},
	oncolor: function(D, S) {
		var d = this.g(D), i = 0; j = d.length;
		for (; i < j ; i++ )
		{
			var a;
			d[i].onmouseover = function() {
				a = this.className;
				this.className += " oncolor";
			}
			d[i].onmouseout = function() {
				this.className = a;
			}
		}
	},
	diplays: function (D, C, N, M) {
		if ( !this.g(D) || !this.g(C))	{
			return;
		}
		var m = this.g(D), n = this.g(C)
		n.onlick = function(){
			if ( m.style.display == "none" ) {
				m.style.display = "";
				n.innerHTML = N;
			}else {
				m.style.display = "none";
				n.innerHTML = M;
			}
		}
	},
	/*
	**  tab: 切换标签 
	**  B:点击标签; T:隐显标签; S:方式 可以是click 也可以是mouseover 默认"mouseover" ; H:tab显示class 默认"current"
	**	$$.tab(".tab_h tt",".tab_d","mouseover","current")
	*/
	tab: function(B,T,S,H) {
		if (!S){var S="mouseover"}
		if (!H){var H="current"};
		$(B).bind(S,function(){
			if($("[temp=chose_tab]").length>0){$("[temp=chose_tab]").attr('temp','')}
			$(this).addClass(H).attr('temp','chose_tab').siblings().removeClass(H);
			for(var i=0;i<$(B).length;i++){
				if($(B).eq(i).attr('temp')=="chose_tab"){break;}
			}
			$(T).eq(i).show().siblings().hide();
		});
	},
	/*
	**  checkAll: 全选标签 
	**  A:点击全选; F:checkbox父标签；I：checkbox 标签;
	**	$$.checkAll(".chose_all",".dy_table","li input")
	*/
	checkAll: function(A,F,I) {
		$(A).click(function(){
			if($("[temp=chose_all]").length>0){$("[temp=chose_all]").attr('temp','')}
			$(this).attr("temp","chose_all");
			for(var i=0;i<$(A).length;i++){
				if($(A).eq(i).attr('temp')=="chose_all"){break;}
			}
			var checkbox=$(F).eq(i).find(I);
			if($(this).attr("checked")==true){
				for (var j=0;j<checkbox.length;j++ ){
					checkbox.eq(j).attr("checked",true);
				}
			}else {
				for (var j=0;j<checkbox.length;j++ ){
					checkbox.eq(j).attr("checked",'');
				}
			}
		});
	},
/*
**  shade: 遮罩层功能 
**  D:触发按钮ID; E:关闭按钮ID【可多个以“,”间隔】; F:亮层ID; W:亮层宽度【可选，默认500】
**	eg: shade("#showshade","#showshadea,#showshadeb..","#lightdiv"[,600])
*/
	shade: function(D,E,F,W) {
		var t = this;
		if (!t.g(D) || !E || !t.g(F)) {
			return;
		}
		var w = W ? W : 642;
		if(!$(D).attr('showflag')){
			$(D).attr('showflag','true');
			t.addEvent(D,"click",function(){t.shadeshow(D,F,w);});
		}
		t.shadehidden(E,F);
		t.shadeshow(D,F,w);
	},
	shadeshow: function(C,D,W){
		var t = this;
		if (!$(D).hasClass('lightbox'))
			$(D).addClass('lightbox');
		var d = t.g(D), ar = t.bodysize(), _f = document.createElement("iframe");
		_f.style.cssText = "position:absolute;z-index:-1;width:0px;height:0px;border:none;_width:100%;_height:"+ar[1]+"px;filter:alpha(opacity=0);";
		$(_f).attr("id","shadowframe");
		var j = window.parent.frames.length;
		var haveShowade = true;
		if (window.parent.frames.length>0){
			for(var i=0;i<j;i++){
				if(window.parent.frames[i].id=="shadowframe")
					haveShowade = false;
			}
		}
		if (haveShowade)
		{
			var _d = document.createElement("div");
			_d.setAttribute("id","shadowbox");
			_d.className = "shadowbox";
			_d.style.cssText = "width:100%;height:"+ar[1]+"px;";
			_d.appendChild(_f);
			if (t.g("#shadowbox"))
				t.g("#shadowbox").style.visibility = "visible";
			else
				document.body.appendChild(_d);
		}
		else {
			if ($.browser.msie && ($.browser.version == "6.0") && !$.support.style) {
				//ie6
				for (; i < j ; i = i + 1 )
				{
					window.parent.frames[i].ie6shadow(ar[1]);
				}
			}
			else {
				for (var i=0; i < j ; i++ )
				{
					if(window.parent.frames[i].id=="shadowframe"){
						var div = document.createElement("div");
						div.setAttribute("id","shadowbox");
						div.className = "shadowbox";
						div.style.cssText = "width:100%;height:"+ar[1]+"px;";
						div.style.visibility = "visible";
						div.appendChild(_f);
						window.parent.frames[i].document.body.appendChild(div);
					}
				}
			}
		}
		var top = $(C).position().top;
		top = 100;
		d.style.cssText = "overflow:hidden;width:"+W+"px;height:auto;left:"+(ar[0]-W)/2+"px;top:"+top+"px;visibility:visible;display:block;";
		$(d).find("select").show();
		d.style.zIndex = 1000;
	},
	shadehidden: function(D,E) {
		var t = this;
		if (D.indexOf(",") == -1) {
			t.addEvent(D,"click",function() {
				fn();
			});
		} else {
			var ar = D.split(","), i = 0; j = ar.length;
			for ( ; i < j ; i ++ ){
				t.addEvent(ar[i],"click",function() {
					fn();
				});
			}
		};
		function fn() {
			t.g(E).style.cssText = "overflow:hidden;visibility:hidden;display:none;";
			$(E).find("select").hide();
			t.g(E).style.zIndex = -1000;
			var d;
			//var j = window.parent.frames.length;
			var j = $("iframe",parent.document).length;
			if ( j < 1)
			{
				if (t.g("#iframe_parameter")){
					t.g("#iframe_parameter").innerHTML = "";
				}
				d = t.g("#shadowbox");
				d.parentNode.removeChild(d);
			}else if (j==1){
				$("#shadowbox").remove();
			}
			else {
				var lightbox_num=0;
				for (var i=0;i<$(".lightbox").length;i++){
					if ($(".lightbox").eq(i).css("visibility")=="visible"){
						lightbox_num++;
					}
						
				}
				if (lightbox_num<1){
					for (i=0; i < j ; i++)
					{
						if (t.g("#iframe_parameter")){
							t.g("#iframe_parameter").innerHTML = "";
						}
						d = (window.parent.frames[i])?window.parent.frames[i].document.getElementById("shadowbox"):window.parent.frames.document.getElementById("shadowbox");
						if(d && d.parentNode)
							d.parentNode.removeChild(d);
						var s = document.getElementById("shadowbox");
						if(s && s.parentNode)
							s.parentNode.removeChild(s);
					}	
				}
				
				
			}
			
		};
	},
	inputvalue: function(D,E,F,fun) {
		var t = this;
		if ( !t.g(D) || !t.g(E) || !F) {
			return;
		};
		t.addEvent(D,"click",function(){
			var e = t.g(E), i = 0, j = e.length, st = "";
			if ( F.indexOf(",") == -1) {
				for ( ; i < j ; i ++ ) {
					st += (e[i].type == "checkbox" && e[i].id != F && e[i].checked == true ) ? e[i].value + "|" : "";
				}
			}
			else {
				var ar = F.split(",");
				var k = 0, l = ar.length, a = "";
				for ( ; k < l ; k ++ ){
					a += (ar[k] + "|");
				}
				var re = eval("(" +"/"+t.cut(a,0,-1)+"/"+")");
				for ( ; i < j ; i ++ ) {
					st += (e[i].type == "checkbox" && !re.exec(e[i].id) && e[i].checked == true ) ? e[i].value + "|" : "";
				}
			}
			fun(t.cut(st,0,-1));
		});
	}, 
	checkhandle: function(D,E,F) {
		var t = this;
		var d = t.g(D), e = t.g(E), f = t.g(F), a = t.cut(E,1,E.length), i = 0, j = d.length;
		for (; i < j; i ++ ) {
			d[i]._p = i;
			d[i].onclick = function() {
				if ( !(this.checked)) {
						e.checked = false;
						return;
				}
				checkall();
			};
			e.onclick = function() {
				var k = 0;
				if (this.checked) {
					for ( ; k < j ; k ++ ) {
						if ( d[k].type == "checkbox" && d[k].id != a) {
							d[k].checked = true;
						}
					}
				} else {
					for ( ; k < j ; k ++ ) {
						if ( d[k].type == "checkbox" && d[k].id != a) {
							d[k].checked = false;
						}
					}
				}
			};
			t.g(F).onclick = function() {
				var k = 0;
				for ( ; k < j ; k ++ ) {
					if ( d[k].type == "checkbox" && d[k].id != a ) {
						d[k].checked = ( d[k].checked == true) ? false : true;
					}
				} 
				checkall();
			};
			function checkall() {
				var k = 0;
				for ( ; k < j ; k ++ )
				{
					if ( d[k].type == "checkbox" && d[k].id != a && !(d[k].checked)) {
						e.checked = false;
						return;
					}
				}
				e.checked = true;
			}
		}
	},
	getPos: function(D) {
		var t = this;
		var d = t.g(D), x, y;  // x = y = 0
		var w = d.offsetWidth, h = d.offsetHeight;
		if( typeof( d.offsetParent ) != 'undefined' ) {
			for( var posX = 0, posY = 0; d; d = d.offsetParent ) {
				posX += d.offsetLeft;
				posY += d.offsetTop;      
			}
			x = posX + w;
			y = posY + h;
			return [ posX,posY,x,y];
		} else{
			x = d.x + w;
			y = d.y + h;
			return [ d.x,d.y,x,y];
		}
	},
	layer: function(D,E) {
		var t = this;
		var d = t.g(D), e = t.g(E), p = arguments;
		var o = (p[2] && isNaN(p[2])) ? p[2] : "mouseover";
		var w = (p[2] && !isNaN(p[2])) ? p[2] : ((p[3] && !isNaN(p[3])) ? p[3] : 106);
		t.addEvent(D,o,function() {
			var ar = t.getPos(D);
			//e.style.cssText = "width:"+w+"px;border:1px solid #2983d2;position:absolute;display:block;top:"+(ar[3]-1)+"px;left:"+(ar[0]-8)+"px;_left:"+(ar[0]-15)+"px;";
			e.style.cssText = "width:"+w+"px;border:1px solid #2983d2;position:absolute;display:block;top:176px;*top:182px;_top:180px;right:20px;";
		});
		t.addEvent(E,"mouseover",function() {
			var ar = t.getPos(D);
			e.style.cssText = "width:"+w+"px;border:1px solid #2983d2;position:absolute;display:block;top:"+(ar[3]-1)+"px;left:"+(ar[0]-8)+"px;_left:"+(ar[0]-15)+"px;";
		});
		t.addEvent(D,"mouseout",function() {
			e.style.cssText = "display:none";
		});
		t.addEvent(E,"mouseout",function() {
			e.style.cssText = "display:none";
		});
	},
	nodeMove: function (D){
		var d = this.g(D)
		for (var i = 0; i < d.length ; i++ )
		{
			if (d[i].className == "nodeup")
			{
				d[i].onclick = function() {
					 moveUp(this)
				}
			}
			else
			{
				d[i].onclick = function() {
					 moveDown(this)
				}
			}
		}
		function moveUp(d){
			var _row=d.parentNode.parentNode;
			if(_row.previousSibling)
				swapNode(_row,_row.previousSibling);
		}
		function moveDown(d){
			var _row=d.parentNode.parentNode;
			if(_row.nextSibling)
				swapNode(_row,_row.nextSibling);
		}
		function swapNode(node1,node2){
			var _parent=node1.parentNode;
			var _t1=node1.nextSibling;
			var _t2=node2.nextSibling;
			if(_t1)
				_parent.insertBefore(node2,_t1);
			else 
				_parent.appendChild(node2);
			if(_t2)
				_parent.insertBefore(node1,_t2);
			else 
				_parent.appendChild(node1);
		}
	},
	writeLoginInfo:function(logininfo){
		logininfo=logininfo||{};
		var domain = document.domain;
		if(domain.indexOf('124.17.10.13')<0){
			modifyDomain = domain.substring(domain.indexOf('.')+1);
		}else{
			modifyDomain = domain;
		}
		var T=this,currentTime=new Date().getTime(),
		loginServer=logininfo.loginServer||"http://www.guangchai.org.cn",
		espServer=logininfo.loginServer||"http://esp.guangchai.org.cn",
		loginUrl=logininfo.loginUrl||loginServer+"/front/user/user-login.action?f=top",
		currentUrl=location.href;
		if(/^http.*(\/front\/user\/user\-login\.action)$/i.test(currentUrl)){
			currentUrl="";
		}
		redirectUrl=logininfo.redirectUrl||currentUrl;
		if(redirectUrl){
			loginUrl+="&redirectURL="+encodeURIComponent(redirectUrl)
		}
		var emailNum;
		var getemailNumUrl=loginServer+"/front/user/getemailnum.action";
        /*$.ajax({
            url: getemailNumUrl,   //接收页面
            type: 'post',      //POST方式发送数据
            async: false,      //ajax同步
            success: function(msg) {
            	emailNum = msg;
            }
        });*/
		regeistUrl=logininfo.regeistUrl||loginServer+"/front/esp/espadmin-registerfirststep.action?f=top";
		logoutUrl=logininfo.logoutUrl||loginServer+"/front/user/user-logout.action?f=top";
		emailUrl=loginServer+"/front/app/appmsg-emaillist.action?source=1";
		espUrl=logininfo.espUrl||espServer+"/front/user/user-dashboard.action?f=top";
		//后期需要处理消息数量
		if(T.isLogin()){
			msg='<div class="logininfo">欢迎您，<a class="user-nick" href="'+espUrl+'" target="_top">'+$.cookie("_login_real_name_")+"</a>！"
			+'<a id="J_Logout" onclick="logout(\''+logoutUrl+'&siteDomain='+modifyDomain+'\')" target="_top" style="cursor: pointer;">退出</a>|<a href="'+emailUrl+'" target="_top" >我的站内信'+emailNum+' </a></div>'
			//需要增加站内信
		}else{
			msg='<div class="w960"><p class="fr"><a href="#" target="_blank">乐马会</a><a href="#" target="_blank" class="ml10">会员中心</a><a href="#" target="_blank" class="ml10">我的订单（<span class="fb fc_orange">0</span>）</a><a href="#" class="ml10">收藏悠乐马</a><a href="#" class="ml10">帮助中心</a></p><span class="fc_gray">您好，欢迎光临悠乐马！</span><a href="'+logoutUrl+'" class="ml10">登录</a> ';
			msg+='| <a href="'+regeistUrl+'">免费注册</a>  </div>';
		}
		document.write(msg);
	},
	isLogin:function(){
		return $.cookie("_login_real_name_");
	},
	loading:function(D,E,F){
		var time=setInterval(setTime,10);
		var x=0;
		var d=g(D);
		var percent=g(E);
		var marker=g(F);
		var m=g(D+" span");
		var t=g(D+" tt");
		var p=g(D+" p");
		function setTime(){
			if(x<99)
			{
				x++;
				m[0].className="red";
				percent.innerHTML=x+"%";
				t[0].style.cssText="width:"+x*2+"px;border-right:1px solid #f47417;";
				marker.style.cssText="margin-left:"+(x*2-2)+"px";		
			}
			else
			{
				p[0].className="red";
				percent.innerHTML="完成";
				marker.style.cssText="margin-left:"+x*2+"px";
				t[0].style.cssText="width:"+(x+1)*2+"px;border:none;";	
				clearInterval(time);
			}
		}
	},
	shadeshowb: function(E,F,G,H,W) {
		//if (!g(D) || !g(E)) {
		//	return;
		//}
		
		var t = this;
		
		var d = t.g("#lightbox"); 
		
		var ar = t.bodysize();
		var _f = document.createElement("iframe");
		//_f.style.cssText = "position:absolute;z-index:-1;width:0px;height:0px;border:none;_width:100%;_height:"+ar[1]+"px;filter:alpha(opacity=0);";
			var j = $("iframe",parent.document).length;
			if (j < 1)
			{
				var _d = document.createElement("div");
				_d.setAttribute("id","shadowbox");
				_d.className = "shadowbox";
				_d.style.cssText = "width:100%;height:"+ar[1]+"px;";
				//_d.appendChild(_f);
				if (t.g("#shadowbox"))
					t.g("#shadowbox").style.visibility = "visible";
				else
					document.body.appendChild(_d);
			}
			else {
				var i = 0, arr = [];
				if ($.browser.msie && ($.browser.version == "6.0") && !$.support.style) {
					//ie6
					
					for (; i < j ; i = i + 1 )
					{
						if (window.parent.frames[i].name!="") {
							window.parent.frames[i].ie6shadow(ar[1]);
						}
					}
				}
				else{
					for (; i < j ; i = i + 1 )
					{
						arr[i] = document.createElement("div");
						arr[i].setAttribute("id","shadowbox");
						arr[i].className = "shadowbox";
						arr[i].style.cssText = "width:100%;height:"+ar[1]+"px;";
						//arr[i].appendChild(_f);
						window.parent.frames[i].document.body.appendChild(arr[i]);
					}
				}
			}
			d.style.cssText = "overflow:hidden;width:"+W+"px;height:auto;left:"+(ar[0]-W)/2+"px;top:100px;visibility:visible;";
			
	},
	now_loading: function(M) {
		var obj = window; 
		if(obj!=obj.parent) {
			var obje=obj.parent.$$.now_loading(M);
			return obje;
		};
		var pagesize=$$.getPageSize();
		obj=obj.document.body;
		var loading_box=document.createElement("div");
		loading_box.setAttribute("id","loading");
		loading_box.className = "loading";
		loading_box.style.cssText = "width:200px;height:140px;position:absolute;top:50%;left:50%;margin-left:-100px;margin-top:-70px;background:url(imgs/loading.gif) no-repeat 85px 70px #ffffff;z-index:100000;text-align:center;line-height:80px;font-size:12px;";
		loading_box.innerHTML=M;
		window.document.body.appendChild(loading_box);

		var shade_box=document.createElement("div");
		shade_box.setAttribute("id","shadowbox");
		shade_box.className = "shadowbox";
		shade_box.style.cssText = "width:"+pagesize[0]+"px;height:"+pagesize[1]+"px;position:absolute;top:0;left:0;";
		obj.appendChild(shade_box);
		var obje=[obj,loading_box,shade_box];
		return obje;
	},
	get_checkbox: function(C){
		var val="";
		for (var i=0;i<$(C).length;i++){
			val+=$(C).eq(i).val();
			if (i!=$(C).length){
				val+=",";
			}
		}
		return val;
	},
	getPageSize: function(){
		var xScroll, yScroll;
		if (window.innerHeight && window.scrollMaxY) {	
			xScroll = document.body.scrollWidth;
			yScroll = window.innerHeight + window.scrollMaxY;
		} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
			xScroll = document.body.scrollWidth;
			yScroll = document.body.scrollHeight;
		} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
			xScroll = document.body.offsetWidth;
			yScroll = document.body.offsetHeight;
		}
		
		var windowWidth, windowHeight;
		if (self.innerHeight) {	// all except Explorer
			windowWidth = self.innerWidth;
			windowHeight = self.innerHeight;
		} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
			windowWidth = document.documentElement.clientWidth;
			windowHeight = document.documentElement.clientHeight;
		} else if (document.body) { // other Explorers
			windowWidth = document.body.clientWidth;
			windowHeight = document.body.clientHeight;
		}	
		
		// for small pages with total height less then height of the viewport
		if(yScroll < windowHeight){
			pageHeight = windowHeight;
		} else { 
			pageHeight = yScroll;
		}

		// for small pages with total width less then width of the viewport
		if(xScroll < windowWidth){	
			pageWidth = windowWidth;
		} else {
			pageWidth = xScroll;
		}


		arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
		return arrayPageSize;
		},
	usermove:function(){			
		var leftuser=document.getElementById("leftuser");
		var rightuser=document.getElementById("rightuser");
		var rightmove=document.getElementById("rightmove");
		var leftmove=document.getElementById("leftmove");
		var rightmoveAll=document.getElementById("rightmoveAll");
		var leftmoveAll=document.getElementById("leftmoveAll");
		var ctrl=0,shift=0;   //0代表未选中状态，1代表选中状态
		leftmovet();
		rightmovet();
		//var shiftArr=[];
		//var swap=0;
		function leftmovet()
		{
			var m=0;
			var leftuserLi=leftuser.getElementsByTagName("li");
			var lenlf=leftuserLi.length;
			for (var i=0;i<lenlf;i++)
			{
				leftuserLi[i].x=i;
				leftuserLi[i].ondblclick=function(){
					this.className=this.className.substr(0,this.className.indexOf("current")-1);
					rightuser.appendChild(this);
					rightmovet();
				};
				leftuserLi[i].onclick=function(){
					if(ctrl==1){
						if(this.className.indexOf("current")==-1){
		            		this.className+=" current";	
		            	} 
		            	else
		            	{
		            		this.className=this.className.substr(0,this.className.indexOf("current")-1);
		            	}                                                           
					}
					else
					{
						var lenlf=leftuserLi.length;
						for (var j=0;j<lenlf;j++){
							m=leftuserLi[j].className.indexOf("current");
							if(m!=-1){leftuserLi[j].className=leftuserLi[j].className.substr(0,m-1);}
						} 
						this.className+=" current";
					}
					/*if(shift==1)
					{
						shiftArr.push(this.x);
						if(shiftArr.length==2){
							if(shiftArr[0]>shiftArr[1])
							{
								swap=parseInt(shiftArr[0])+1;
								shiftArr[0]=shiftArr[1];
								shiftArr[1]=swap;
							}
							for(var z=shiftArr[0];z<shiftArr[1];z++)
							{
								leftuserLi[z].className+=" current";
							}
							shiftArr=[];
						}
					}*/
				};
			}
		};
		
		function rightmovet()
		{
			var m=0;
			var rightuserLi=rightuser.getElementsByTagName("li");
			var lenrt=rightuserLi.length;
			for (var i=0;i<lenrt;i++)
			{
				rightuserLi[i].x=i;
				rightuserLi[i].ondblclick=function(){
					this.className=this.className.substr(0,this.className.indexOf("current")-1);
					leftuser.appendChild(this);
					leftmovet();
				};
				rightuserLi[i].onclick=function(){
					if(ctrl==1){
						if(this.className.indexOf("current")==-1){
		            		this.className+=" current";	
		            	} 
		            	else
		            	{
		            		this.className=this.className.substr(0,this.className.indexOf("current")-1);
		            	}                                                           
					}
					else
					{
						var lenrt=rightuserLi.length;
						for (var j=0;j<lenrt;j++){
							m=rightuserLi[j].className.indexOf("current");
							if(m!=-1){rightuserLi[j].className=rightuserLi[j].className.substr(0,m-1);}
						} 
						this.className+=" current";
					}
					/*if(shift==1)
					{
						shiftArr.push(this.x);
						if(shiftArr.length==2){
							if(shiftArr[0]>shiftArr[1])
							{
								swap=parseInt(shiftArr[0])+1;
								shiftArr[0]=shiftArr[1];
								shiftArr[1]=swap;
							}
							for(var z=shiftArr[0];z<shiftArr[1];z++)
							{
								leftuserLi[z].className+=" current";
							}
							shiftArr=[];
						}
					}*/
				};
			}
		};
		
	rightmove.onclick=function(){
		var leftuserLi=leftuser.getElementsByTagName("li");
		var lenlf=leftuserLi.length;
		for (var i=lenlf-1;i>=0;i--)
		{
			if(leftuserLi[i].className.indexOf("current")!=-1){
				leftuserLi[i].className=leftuserLi[i].className.substr(0,leftuserLi[i].className.indexOf("current")-1);
				rightuser.appendChild(leftuserLi[i]);
			}
		}
	};

	leftmove.onclick=function(){
		var rightuserLi=rightuser.getElementsByTagName("li");
		var lenrt=rightuserLi.length;
		for (var i=lenrt-1;i>=0;i--)
		{
			if(rightuserLi[i].className.indexOf("current")!=-1){
				rightuserLi[i].className=rightuserLi[i].className.substr(0,rightuserLi[i].className.indexOf("current")-1);
				leftuser.appendChild(rightuserLi[i]);
			}
		}
	};

	rightmoveAll.onclick=function(){
			var leftuserLi=leftuser.getElementsByTagName("li");
			var lenlf=leftuserLi.length;
			for (var i=0;i<lenlf;i++)
			{
				var t=leftuserLi[0].className.indexOf("current");
				if(t!=-1){leftuserLi[0].className=leftuserLi[0].className.substr(0,t-1);}
				rightuser.appendChild(leftuserLi[0]);
			}
			leftmovet();
			rightmovet();
		};
	leftmoveAll.onclick=function(){
			var rightuserLi=rightuser.getElementsByTagName("li");
			var lenrt=rightuserLi.length;
			for (var i=0;i<lenrt;i++)
			{
				var t=rightuserLi[0].className.indexOf("current");
				if(t!=-1){rightuserLi[0].className=rightuserLi[0].className.substr(0,t-1);}
				leftuser.appendChild(rightuserLi[0]);
			}
			leftmovet();
			rightmovet();
		};
	   document.onkeydown = function(e){
	   var currKey=0,e=e||event,keyName;
	   currKey=e.keyCode||e.which||e.charCode;
	   if (currKey==16)
	   {
		   shift=1;
		   }
	   else if (currKey==17)
	   {
		   ctrl=1;
		   }
	   };
	   document.onkeyup = function(e){
		   var currKey=0,e=e||event,keyName;
		   currKey=e.keyCode||e.which||e.charCode;
		   if (currKey==16)
		   {
			   shift=0;
			   }
		   else if (currKey==17)
		   {
			   ctrl=0;
			   }
		   };
	}
};
var $$ = new AR();


function frontLeftsideClass(mark){
	$("ul li[name=sidepiece]").each(function(){
		var id = $(this).attr("id");
		if(id == mark){
			$(this).addClass("clickon");
		}
	});
}
function ie6shadow(bd_height){
	var div = document.createElement("div");
	div.setAttribute("id","shadowbox");
	div.className = "shadowbox";
	div.innerHTML = "<iframe width='100%' scrolling='no' height='"+bd_height+"px' frameborder='0' style='background:#000;filter:alpha(opacity=0);-moz-opacity:0.0;-khtml-opacity: 0.0;opacity: 0.0;'></iframe>";
	div.style.cssText = "width:100%;height:"+bd_height+"px;";
	div.style.visibility = "visible";
	document.body.appendChild(div);
}
function logout(ctx){
	var uri = ctx.substring(ctx.indexOf("siteDomain")+1);
	var siteDomain = uri.substring(uri.indexOf("=")+1);
	$.cookie('_login_login_name_', null, { path: '/' });
	$.cookie('_login_real_name_', null, { path: '/' ,domain:siteDomain});
	document.location.href=ctx; 
}

function lightbox(l,w,h,i,ifi){
	//l=地址  w=宽度 h=高度 i="yes"显示遮罩  无则不显示遮罩
	if (w==null){w=500;}
	if (h==null){h=300;}
	var htmls="";
	if(l.indexOf("?")!=-1){
		l +="&random="+Math.random();
	}
	else{
		l+="?random="+Math.random();
	}
	if (ifi){$("<div id='lightbox' style='width:"+w+"px;height:"+h+"px;'><div class='ltbx_tit'><span class='pl'></span><span class='pr'></span>短信模板<span onclick='close_lightbox()' class='close'></span></div><iframe name='hidden_iframe1' frameborder=0 id='hidden_iframe1' src="+l+" width="+w+" height="+h+"> </iframe></div>").appendTo("body");}
	else {
		$("<div id='lightbox' style='width:"+w+"px;height:"+h+"px;left:"+(($("body").width()-w)/2)+"px;'></div>").appendTo("body");
		$("#lightbox").load(l).fadeIn();
	}
	//$("<div id='lightbox' style='width:"+w+"px;height:"+h+"px;'></div>").appendTo("body");
	
	if (i!="yes"){shadowbox();}
}

function shadowbox(y){
	//y为空时 是显示遮罩层  有值时 删除遮罩层
	var par_body=$(window.parent.document).find("iframe");
	var wa_height=$("#wrapper").height();
	var i=0;
	if (y==null){
		for (;i<par_body.length;i++){
		window.parent.frames[i].addshadow(wa_height);
		}
	}
	else {
		for (;i<par_body.length;i++){
		par_body.eq(i).contents().find("#shadowbox").remove();
		par_body.eq(i).contents().find("#shadowbox").remove();
		}
	}
}

function close_lightbox(){
	$("#lightbox").remove();
	shadowbox(1);
}